﻿<CodeSnippetTabbed>
    <CodeSnippetTabPage Text="Razor">@(@"<DxDataGrid Data=""@DataSource""
                HorizontalScrollBarMode=""ScrollBarMode.Visible""
                PagerNavigationMode=""PagerNavigationMode.NumericButtons""
                RowRemovingAsync=""@OnRowRemoving""
                RowUpdatingAsync=""@OnRowUpdating""
                CssClass=""mw-1100"">

        <DxDataGridCommandColumn NewButtonVisible=""false"" Width=""100px"" FixedStyle=""DataGridFixedStyle.Left""></DxDataGridCommandColumn>

        <DxDataGridColumn Field=""@nameof(ProductFlat.ProductName)"" Caption=""Product Name"" Width=""250px"">
        </DxDataGridColumn>

        <DxDataGridCheckBoxColumn Field=""@nameof(ProductFlat.Availability)"" Caption=""Availability"" Width=""110px"" FixedStyle=""DataGridFixedStyle.Right"">
            <DisplayTemplate>
                @{
                    var id = Guid.NewGuid().ToString();
                    var inStock = (context as ProductFlat).Availability;
                    <DxCheckBox Id=""@id"" Checked=""@inStock"" Enabled=""false"">
                        @if (inStock)
                        {
                            <label class=""form-check-label text-success"" for=""@id""><span>In stock</span></label>
                        }
                        else
                        {
                            <label class=""form-check-label text-danger"" for=""@id""><span>Sold out</span></label>
                        }
                    </DxCheckBox>
                }
            </DisplayTemplate>
        </DxDataGridCheckBoxColumn>

        <DxDataGridColumn Field=""@nameof(ProductFlat.Category)"" Caption=""Category"" Width=""250px""></DxDataGridColumn>
        <DxDataGridColumn Field=""@nameof(ProductFlat.Subcategory)"" Caption=""Subcategory"" Width=""250px""></DxDataGridColumn>
        <DxDataGridDateEditColumn Field=""@nameof(ProductFlat.LastUpdated)"" Caption=""Last Updated"" Width=""250px""></DxDataGridDateEditColumn>

    </DxDataGrid>")</CodeSnippetTabPage>
</CodeSnippetTabbed>
